﻿namespace SourceCodeRepository.Web.Controllers.Home.Language
{
    using System.Web.Mvc;
    using Persistence.Repositories.Interfaces;

    /// <summary>
    /// Controller class for the Languague view
    /// </summary>
    public class LanguageController : BaseController
    {
        /// <summary>
        /// Gets the language repository.
        /// </summary>
        /// <value>The language repository.</value>
        protected ILanguageRepository LanguageRepository
        {
            get;
            set;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="LanguageController"/> class.
        /// </summary>
        /// <param name="languageRepository">The language repository.</param>
        public LanguageController(ILanguageRepository languageRepository)
        {
            this.LanguageRepository = languageRepository;
        }

        /// <summary>
        /// Lists the languages.
        /// </summary>
        /// <param name="pageIndex">The page index</param>
        /// <returns>An ActionResult</returns>
        public ActionResult ListLanguages(int? pageIndex)
        {
            return View("ShowLanguages", this.LanguageRepository.GetAll(0));
        }

        /// <summary>
        /// Shows the default view of the controller.
        /// </summary>
        /// <returns></returns>
        public override ActionResult ShowView()
        {
            return this.ListLanguages(0);
        }

        public ActionResult ShowCreateLanguageView()
        {
            return null;
        }

        public ActionResult CreateLanguage()
        {
            return null;
        }
    }
}